<%--

  Licensed under the GNU LESSER GENERAL PUBLIC LICENSE, version 2.1, dated February 1999.

  This program is free software; you can redistribute it and/or modify
  it under the terms of the latest version of the GNU Lesser General
  Public License as published by the Free Software Foundation;

  This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU Lesser General Public License for more details.

  You should have received a copy of the GNU Lesser General Public License
  along with this program (LICENSE.txt); if not, write to the Free Software
  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

--%>
<%@ page errorPage="/WEB-INF/jsp/error.jsp"
    contentType="text/html; charset=utf-8"
%>
<%@page import="org.jamwiki.servlets.ServletUtilEx"%>
<%@page import="org.jamwiki.servlets.WikiPageInfo"%>

<%@ include file="page-init.jsp" %>

<%@ include file="top.jsp" %>


<%@page import="org.lightframework.jamwiki.servlets.WikiContext"%><c:set var="contentJsp" scope="page" value="${pageInfo.contentJsp}" />
<%
	// Servlet 2.3 doesn't understand the EL language, so a scriptlet has to be used...
String contentJsp = (String)pageContext.getAttribute("contentJsp");
%>

<%
	boolean embed = WikiContext.isEmbedMode();

	if(embed){
		String embedView = "embed-" + contentJsp;
		if(!ServletUtilEx.isViewExists(pageContext.getServletContext(),request,embedView)){
			embedView = contentJsp;
		}
%>
	<div id="wiki-page">
		<div id="wiki-content" style="margin-left:0;">
			<div id="contents" >
				<jsp:include page="<%= embedView %>" flush="true" />
			</div>
		</div>
	</div>
<%}else{%>
	<div id="wiki-page">
		<div id="top-panel">
		<%@ include file="user-menu.jsp"%>
		</div>
	
	<c:if test="${!isSpecialWiki}">		
		<div id="wiki-navigation">
			<div class="panel-head"><fmt:message key="leftmenu.search.title"/></div>
			<div id="nav-search">
			<form method="post" action="<jamwiki:link value="Special:Search" />">
			<input type="text" name="text" value=""/>
			<input type="submit" name="search" value='<fmt:message key="generalmenu.search"/>'/>
			</form>
			</div>
		
			<c:if test="${!empty leftMenu && leftMenu != '<br/><br/>'}">
			<br/>
			<div class="panel-head">
				<div style="float:left">
				<fmt:message key="leftmenu.nagivation.title"/>
				</div>
				<%if(ServletUtilEx.isTopicEditable("LeftMenu")){ %>
				<div style="float:right;font-size:9pt;font-weight:normal;margin-top:2px;margin-right:2px">
					<a style="edit" href="<%=LinkUtilEx.buildTopicEditUrl("LeftMenu")%>"><fmt:message key="tab.common.edit"/></a>
				</div>
				<%}%>
			</div>
			<div id="nav-menu">
			<c:out value="${leftMenu}" escapeXml="false" />
			</div>
			</c:if>
		</div>
	</c:if>
	<div id="wiki-content" <c:if test="${isSpecialWiki}">style="margin-left:0"</c:if>>
		<%@ include file="top-menu.jsp"%>
		<div id="contents" >
		<h1 id="contents-header">
		<%if(WikiContext.isViewTopic()){%>
		<img src="<%=context%>/images/wiki_topic.jpg" border="0" style="position:relative;top:200;float:left;padding-top:2px;padding-right:8px"/>
		<%}%>
		<fmt:message key="${pageInfo.pageTitle.key}"><fmt:param value="${pageInfo.pageTitle.params[0]}" /></fmt:message></h1>
		<c:if test="${!empty pageInfo.redirectUrl}">
		<div id="contents-subheader"><fmt:message key="topic.redirect.from"><fmt:param><a href="<c:out value="${pageInfo.redirectUrl}" />"><c:out value="${pageInfo.redirectName}" /></a></fmt:param></fmt:message></div>
		</c:if>
		<jsp:include page="<%= contentJsp %>" flush="true" />
		<br />
		</div>
	</div>
	</div>
	<%@ include file="wiki-footer.jsp"%>
<%}%>
<%@ include file="close-document.jsp"%>
